package edu.pw.p2pclient.networking.messages;

import java.io.Serializable;
import java.net.InetAddress;
import java.net.Socket;

public class Message implements Serializable {

	private static final long serialVersionUID = 393969220758882629L;

	public enum MsgType {

		RESOURCE_PART_REQUEST, RESOURCE_LIST_REQUEST, RESOURCE_PART_RESPONSE, RESOURCE_LIST_RESPONSE, HELLO_MESSAGE, GOODBYE_MESSAGE, DENIAL;
	}

	private MsgType mMsgType;
	private transient InetAddress mSenderAddress;

	public Message(MsgType msgType) {

		mMsgType = msgType;
		mSenderAddress = null;
	}

	public Message(MsgType msgType, InetAddress deviceAddress) {

		mMsgType = msgType;
		mSenderAddress = deviceAddress;
	}

	public Message(MsgType msgType, Socket socket) {

		mMsgType = msgType;
		mSenderAddress = null;
	}

	public MsgType getMsgType() {
		return mMsgType;
	}

	public InetAddress getSenderAddress() {
		return mSenderAddress;
	}

	public void setSenderAddress(InetAddress senderAddress) {
		this.mSenderAddress = senderAddress;
	}

}
